1
超越知識截止點:為何大語言模型需要外部資料
AI011Lesson 6
00:00

超越知識截止點

大型語言模型功能強大,但存在一個根本性的限制: 知識截止點。為了建立可靠的AI系統,我們必須彌補靜態訓練資料與動態現實資訊之間的差距。

1. 知識截止點問題(是什麼)

大型語言模型使用龐大但靜態的資料集進行訓練,且有固定的結束日期(例如GPT-4截至2021年9月)。因此,這些模型無法回答關於近期事件、軟體更新或訓練期後產生的私人資料的問題。

2. 虛構與現實的對比(為什麼)

當被問及未知或截止後的資料時,模型經常會 虛構——捏造看似合理卻完全錯誤的事實以滿足提示要求。解決方案是 接地:在模型生成答案前,從外部知識庫提供即時且可驗證的上下文。

3. RAG 與微調的比較(如何)

  • 微調: 更新模型內部權重計算成本高、速度慢,且導致知識靜態化,很快又會過時。
  • RAG (檢索增強生成): 極具成本效益。它能即時檢索相關資訊並注入提示中,確保資料最新,且可在不重新訓練的情況下輕鬆更新知識庫。
私密資料的缺口
除非透過檢索管道明確整合,否則大型語言模型無法存取公司內部手冊、財務報告或機密文件。
grounding_check.py
TERMINALbash — 80x24
> Ready. Click "Run" to execute.
>
Question 1
Why is Retrieval Augmented Generation (RAG) preferred over fine-tuning for updating an LLM's knowledge of daily news?
Fine-tuning prevents hallucinations entirely.
RAG is more cost-effective and provides up-to-date, verifiable context.
RAG permanently alters the model's internal weights.
Fine-tuning is faster to execute on a daily basis.
Question 2
What term describes an LLM's tendency to invent facts when it lacks information?
Grounding
Embedding
Hallucination
Tokenization
Challenge: Building a Support Bot
Apply RAG concepts to a real-world scenario.
You are building a support bot for a new product released today. The LLM you are using was trained two years ago.
Product Manual
Task 1
Identify the first step in the RAG pipeline to get the product manual into the system so the LLM can search it.
Solution:
Preprocessing (Cleaning and chunking the manual text into smaller, searchable segments before embedding).
Task 2
Define a "System Message" that forces the LLM to only use the provided documents and prevents hallucination.
Solution:
"Answer only using the provided context. If the answer is not in the context, state that you do not know."